xxl-job 服务端安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| docker run -d -e PARAMS="--spring.datasource.url=jdbc:mysql://192.168.2.90:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=UTC \ --spring.datasource.username=root \ --spring.datasource.password=obcijV6j5BjvLLB8gJZpUC6aho \ --spring.datasource.driver-class-name=com.mysql.jdbc.Driver" \ -p 9088:8080 \ -v /data/xxl-job:/data/applogs \ --name xxl-job \ -d xuxueli/xxl-job-admin:2.3.0
IP:9088/xxl-job-admin
|
xxl-job 执行器部署
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| wget https://github.com/xuxueli/xxl-job/archive/refs/tags/2.3.0.zip unzip 2.3.0.zip
<property name="log.path" value="/Users/macbook/Software/log/xxl-job-executor-sample-springboot.log"/>
server.port=9088 xxl.job.admin.addresses=http://192.168.2.93:9088/xxl-job-admin
xxl.job.executor.appname=test-admin-api-cron-executor-sample xxl.job.executor.logpath=/opt
|
将执行器打入容器中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| FROM csm.io/php:apache-composer-v1 RUN mkdir -p /var/www/csm/runtime/log && mkdir /var/www/csm/runtime/session && mkdir /var/www/csm/runtime/tmp && chown -R www-data. /var/www/csm/runtime/
WORKDIR /var/www/csm
ADD ./xxl-job-executor.jar /opt/ ADD ./jdk-8u311-linux-i586.tar.gz /opt/
ADD ./test-admin-api-cron.tar.gz /var/www/csm ADD ./\.env /var/www/csm ADD ./000-default.conf /etc/apache2/sites-enabled/000-default.conf RUN composer config -g secure-http false && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && composer config -g -l RUN echo "Asia/Shanghai" > /etc/timezone && composer update
RUN apt-get update && \ apt-get install -y libc6-i386 && \ /opt/jdk1.8.0_311/bin/java -version
CMD [ "/opt/jdk1.8.0_311/bin/java", "-jar" ,"xxl-job-executor.jar" ]
cat cron.sh
/opt/jdk1.8.0_311/bin/java -jar xxl-job-executor.jar
|
xxl-job 服务端配置执行器与任务
AppName 需与 jar 打入的配置相同,查看执行器是否自动注册
编写执行任务